﻿using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestGame {
    interface I_Path {
        Vector2 CalculatePosition(Vector2 initial, TimeSpan time);
        bool HasReachedEnd();
    }

    class LinearPath : I_Path {
        float deltaX;
        float deltaY;
        TimeSpan maxTime;

        public LinearPath(float xCoefficent, float yCoefficent, TimeSpan time) {
            deltaX = xCoefficent;
            deltaY = yCoefficent;
            maxTime = time;
        }

        public Vector2 CalculatePosition(Vector2 initial, TimeSpan time) {
            float xChange = (float)(deltaX * time.TotalSeconds);
            float yChange = (float)(deltaY * time.TotalSeconds);
            Vector2 change = new Vector2(xChange, yChange);

            maxTime = maxTime - time;

            return initial + change;
        }

        public bool HasReachedEnd() {
            return maxTime <= TimeSpan.Zero;
        }
    }
}
